package _8GuoLvQi.impl;

import _8GuoLvQi.Criteria;
import _8GuoLvQi.Person;

import java.util.List;

/**
 * @AndCriteria: 都符合标准
 * @author: ZBoHang
 * @time: 2021/9/7 15:38
 */
public class AndCriteria implements Criteria {

    private Criteria criteria;
    private Criteria otherCriteria;

    public AndCriteria(Criteria criteria, Criteria otherCriteria) {
        this.criteria = criteria;
        this.otherCriteria = otherCriteria;
    }

    @Override
    public List<Person> meetCriteria(List<Person> persons) {
        List<Person> list = criteria.meetCriteria(persons);
        return otherCriteria.meetCriteria(list);
    }
}
